
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>字符流 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>字符流 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">在Java I/O中，用于处理字符流的两个核心抽象基类是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">用于读取字符流的抽象类是 `Reader`，用于写入字符流的抽象类是 `Writer`。</div>
          </div>
          <div class="card-source">来源: 1 应用驱动API学习-字符流一</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">根据文档，`Reader` 和 `Writer` 的子类必须强制实现哪些核心方法？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`Reader` 的子类必须实现 `read(char[], int, int)` 和 `close()`。`Writer` 的子类必须实现 `write(char[], int, int)`、`flush()` 和 `close()`。</div>
          </div>
          <div class="card-source">来源: 1 应用驱动API学习-字符流一</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">`InputStreamReader` 和 `OutputStreamWriter` 在字节流和字符流之间扮演了什么关键角色？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">它们是连接字节流和字符流的“桥梁”。`InputStreamReader` 使用指定的字符集（charset）读取字节并将其解码为字符；`OutputStreamWriter` 则将字符编码成字节后写入流。</div>
          </div>
          <div class="card-source">来源: 1 应用驱动API学习-字符流一</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">`FileReader` 和 `FileWriter` 被称作“便捷类”，这是为什么？在什么情况下我们可能需要避免使用它们？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">因为它们的构造方法假定了默认的字符编码和字节缓冲区大小是可接受的，从而简化了代码。如果需要自己指定这些值，就应该避免使用它们，而是直接在 `FileInputStream` 或 `FileOutputStream` 上构造一个 `InputStreamReader` 或 `OutputStreamWriter`。</div>
          </div>
          <div class="card-source">来源: 2 为了简化上述代码的编写，API给上述的两种转换流都提供了相关的子类</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">使用 `BufferedReader` 和 `BufferedWriter` 的主要优势是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">它们自带缓冲区，通过缓冲各个字符，可以实现对单个字符、数组、行或字符串的高效读取和写入。</div>
          </div>
          <div class="card-source">来源: 3 自带缓冲区的流</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在使用 `BufferedReader` 或 `BufferedWriter` 时，它们的缓冲区大小是固定的吗？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">不是固定的。可以手动指定缓冲区的大小，也可以使用默认的大小，文档指出在大多数情况下默认值就足够大了。</div>
          </div>
          <div class="card-source">来源: 3 自带缓冲区的流</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">`InputStreamReader` 如何处理字符编码？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">它使用指定的 `charset` 读取字节并将其解码为字符。该字符集可以由名称指定、显式给定，或者接受平台默认的字符集。</div>
          </div>
          <div class="card-source">来源: 1 应用驱动API学习-字符流一</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">`FileWriter` 是哪个类的直接子类？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`FileWriter` 继承自 `OutputStreamWriter` 类。</div>
          </div>
          <div class="card-source">来源: 2 为了简化上述代码的编写，API给上述的两种转换流都提供了相关的子类</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在何种场景下，开发者应选择使用 `InputStreamReader` 而非 `FileReader`？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">当需要自定义字符编码或字节缓冲区大小时，应选择 `InputStreamReader`。因为 `FileReader` 是一个便捷类，它假定默认的字符编码和缓冲区大小是适当的。</div>
          </div>
          <div class="card-source">来源: 2 为了简化上述代码的编写，API给上述的两种转换流都提供了相关的子类</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
